package com.it.schoolbookshop_back.enums;

/**
 * 查询排序方式枚举
 */
public enum SortByEnum {
    TIME_DESC("time_desc"),
    PRICE_ASC("价格从低到高"),
    PRICE_DESC("价格从高到低"),
    CONDITION_PRIORITY("品相优先");

    private final String label;

    SortByEnum(String label) {
        this.label = label;
    }

    public String getLabel() {
        return label;
    }

    public static SortByEnum fromLabel(String label) {
        for (SortByEnum e : values()) {
            if (e.label.equals(label)) {
                return e;
            }
        }
        return TIME_DESC;
    }
} 